<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%String path = request.getContextPath();%>
<html>
<head>
    <title>Title</title>
    <script>
        $(function (){
            $('#testfile').fileinput({
                language: 'zh',
                uploadUrl: '<%=path%>/file/upLoadFile',
                maxFileCount : 1,
                enctype : "multipart/form-data",
                maxFileSize : 10240,
                allowedFileExtensions : ["jpg", "png", "gif"],
                browseClass: 'btn btn-primary',
                //下面几个就是初始化预览图片的配置
                initialPreviewAsData: true,//是否初始预览图片
                initialPreviewFileType: 'image',//回显文件类型（初始预览文件类型）
                initialPreview: "<%=path%>/file/download?filename=${skill.skillImg}",

            });

            $("[name=myFile]").on("fileuploaded", function(event, data, previewId, index){
                var imgUrl = data.response.imgUrl;
                $("#skillImg").val(imgUrl);
            })
        })
    </script>
</head>
<body>
    <form role="form" id="skill_update_form">
        <input type="hidden" name="skillId" value="${skill.skillId}">

        <div class="form-group">
            <label for="skillName">技能名:</label>
            <input type="text" class="form-control" id="skillName" name="skillName" placeholder="技能名" value="${skill.skillName}">
        </div>

        <div class="form-group">
            <label for="skillDescribe">技能描述:</label>
            <input type="text" class="form-control" id="skillDescribe" name="skillDescribe" placeholder="技能描述" value="${skill.skillDescribe}">
        </div>

        <div class="form-group">
            <label for="skillEvaluate">技能备注:</label>
            <input type="text" class="form-control" id="skillEvaluate" name="skillEvaluate" placeholder="技能备注" value="${skill.skillEvaluate}">
        </div>

        <div class="form-group">
            <label>稀有度:</label>
            <select name="rightId">
                <option value="-1">请选择</option>
                <c:forEach items="${rights}" var="p">
                    <option value="${p.rightId}" <c:if test="${skill.rightId == p.rightId}">selected</c:if>>${p.rightGrade}</option>
                </c:forEach>
            </select>
        </div>

        <div class="form-group" style="width:300px;height:300px">
            <label for="testfile">技能样式:</label>
            <input type="file" id="testfile" name="myFile" multiple />
            <input type="hidden" name="skillImg" id="skillImg" value="${skill.skillImg}">
        </div>
    </form>
</body>
</html>
